var send = ctx + "system/sendBack";
$(function () {
    let wfId = $('#wfId').val();
    //拟派电话工单列表
    var options = {
        url: send + '/simulacrumList/' + wfId,
        sortName: "pkid",
        sortOrder: "desc",
        uniqueId: "pkId",
        showColumns: false,                  //是否显示所有的列（选择显示的列）
        showRefresh: false,
        showSearch: false,
        showToggle: false,
        fixedColumns: true,
        fixedNumber: 1,
        fixedRightNumber: 1,
        columns: [{
            field: 'pkId',
            title: 'id',
            visible: false
        },
            {
                field: 'seqName',
                title: '交办次序',
                width: 100,
                align: 'center',
            }, {
                field: 'sortName',
                title: '办理性质',
                width: 100,
                align: 'center',
            }, {
                field: 'dealName',
                title: '办理方式',
                width: 100,
                align: 'center',
            }, {
                field: 'sbdeptName',
                title: '承办单位',
                width: 240,
                align: 'center',
            }, {
                field: 'sdeptName',
                title: '派发单位',
                width: 240,
                align: 'center',
            }, {
                field: 'backLimit',
                title: '要求期限',
                width: 160,
                align: 'center',
            },
            {field:'suserName',title:'派发人',align:'center'},
            {field:'sendTime',title:'派发时间',align:'center',width: 160,sortable:true},
            {field:'sendState',title:'办理情况',align:'center',sortable:true,formatter:function(value,row,index){return fmtSBSendState(value,row,index);}},
            {field:'getTime',title:'签收时间',align:'center',width: 160,},
            {field:'getPerson',title:'签收人',align:'center',sortable:true},
            {field:'buserName',title:'回复人',align:'center'},
            {field:'backTime',title:'回复时间',align:'center',width: 160,sortable:true},
            {
                field : 'wfId',
                title: '操作',
                width: 60,
                align: 'center',
                valign: 'middle',
                formatter: actionFormatter
            }]
    };
    $.table.init(options);
});

function actionFormatter(value, row, index) {
    var id = value;
    var result = "";
    result += "<a href='javascript:;' class='btn btn-xs blue' onclick=\"detail('" + id + "','"+row.pkId+"')\" title='详情'><span>详情</span></a>";
    return result;
}

function detail(wfId,id){

    var url = send + "/sendBackRecordDetail/"+wfId+"/"+id;
    $.modal.openDialog('回访记录详情', url,'60%','84%');
}